var person = {
    /**
     * 名字
     */
    name: '皇帝',
    wenxue: 100,
    wushu: 100,
    caiyi: 70,
    daode: 80,
    tineng: 100,
    age: 20,
    tili: 90,
    jiankang: 89,
    kuaile: 100,
    money: 10000000,
    huangwei: 500,
    goods: ['吊杆']
}
// 所有的npc
var npcList = [
    {
        name: '路人甲', img: 'img/person/1.jpg', msg: [
            '我明明在这里丢了10两银子，怎么就找不到了呢?',
            '他说着说着就走远了~',
        ]
    },
    {
        name: '外国和尚', img: 'img/person/100.jpg', msg: [
            '外国的和尚不会念经的1',
            '外国的和尚不会念经的2'
        ]
    },
    {
        name: '说书人', img: 'img/person/103.jpg', msg: [
            'xxxxxxxxxxx1',
            'xxxxxxxxxxx2',
            'xxxxxxxxxxx3',
        ]
    },
    {
        name: '读书人', img: 'img/person/huanren.jpg', msg: [
            '子曰：万般皆下品唯有读书高~',
            '你：“子还曰过什么？”',
            '读书人看了你一眼就走了'
        ]
    },
    {
        name: '乞丐', img: 'img/person/102.jpg', msg: [
            '可怜可怜我这个乞丐吧',
            '我已经3天没有吃饭了',
            '我想去回春楼喝点花酒~',
            '你一巴掌打了过去',
        ]
    },
];
/**
 *左上角的人数数据
 *
 */
function showPersonData() {
    var datetime = getTimeString();// 获取当前时间
    var html = `<div class="renwu-shuju">
    <div class="title">`+ datetime + `</div>
    <div class="datas">
        <span class="item">文学:`+ person.wenxue + `</span>
        <span class="item">武术:`+ person.wushu + `</span>
        <span class="item">才艺:`+ person.caiyi + `</span>
        <span class="item">道德:`+ person.daode + `</span>
        <span class="item">体能:`+ person.tineng + `</span>
        <span class="item">年龄:`+ person.age + `</span>
        <span class="item">体力:`+ person.tili + `</span>
        <span class="item">健康:`+ person.jiankang + `</span>
        <span class="item">快乐:`+ person.kuaile + `</span>
        <span class="item" style="width:66.6%">金库:`+ person.money + `</span>
        <span class="item">皇威:`+ person.huangwei + `</span>
        <br class="clear" />
    </div>
</div>`;
    writeHTML(html, 10, 10)
}

async function main() {
    playMusic('mp3/xin_piantou.mp3', true, true);
    DrawBackgroundImage('img/login_fengmian.jpg')
    writeHTML('<img src="img/LOGO_heng.png">', 195, 120)
    writeHTML('<button class="btn">开始游戏</button>', 350, 300, startGame)
}
async function startGame() {
    showQianchao();
}
// 获取随机的npc
function getRandomNPC() {
    var r = parseInt(Math.random() * npcList.length);//获取随机数
    var npc = npcList[r]; // 通过获取的随机数 拿到npc
    return npc;
}
/**
 * 产生1~10的随机数
 */
function getRandomNumber() {
    return parseInt(Math.random() * 10) + 1;
}